#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QLineEdit>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QPaintEvent>
#include <QPainter>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void on_startButton_clicked();
    void on_stopButton_clicked();
    void on_screenshotButton_clicked();
    void readHttpCameraData();

protected:
    void paintEvent(QPaintEvent *e) override;

private:
    Ui::Widget *ui;
    QNetworkAccessManager *networkManager;
    QNetworkReply *networkReply;
    int totalLen;
    QByteArray buf;
    int len;
    int currentLen;
    QImage image;
    int statu;
    QLineEdit *urlLineEdit;
};
#endif // WIDGET_H